import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { IndexComponent } from './view/index/index.component';
import { ArticlesComponent } from './view/articles/articles.component';
import { MyselfComponent } from './view/myself/myself.component';
import { Page404Component } from './view/page404/page404.component';
import { Article1Component } from './view/article1/article1.component';
import { Article2Component } from './view/article2/article2.component';
import { Article3Component } from './view/article3/article3.component';

// 配置路由信息对象
const routes: Routes = [
  {
    path: '',
    component: IndexComponent,
    children: [{
      path: '',
      component: Article1Component,
    },
    {
      path: 'article2',
      component: Article2Component,
    },
    {
      path: 'article3',
      component: Article3Component,
    }]
  },
  {
    path: 'articles',
    component: ArticlesComponent,
    children: [{
      path: '',
      component: Article1Component,
    },
    {
      path: 'article2',
      component: Article2Component,
    },
    {
      path: 'article3',
      component: Article3Component,
    }]
  },
  {
    path: 'myself',
    component: MyselfComponent
  },
  {
    path: '**',
    component: Page404Component
  }
];
@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
